package com.ruoyi.api.user.response;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.LinkedList;
import java.util.List;

public class StepDataResponseVo {
	
	private static final long serialVersionUID = 1L;
	
	/** 总步数  */
	private Integer totalStep = 0;
	
	/** 完成度 */
	private String percentage = "0";
	
	/** 总距离 */
	private String totalKm = "0";
	
	/** 大卡 */
	private String totalKa = "0";
	
	/** 运动列表 */
	private List<StepListResponseVo> list = new LinkedList<StepListResponseVo>();

	public Integer getTotalStep() {
		return totalStep;
	}

	public void setTotalStep(Integer totalStep) {
		this.totalStep = totalStep;
		setTotalKm(totalStep);
	}

	public String getPercentage() {
		return percentage;
	}

	public void setPercentage(String percentage) {
		this.percentage = percentage;
	}
	
	public void setPercentage(Integer target,Integer total) {
		BigDecimal a;
		BigDecimal b;
		BigDecimal e;
		BigDecimal h;
		a = new BigDecimal(target);
		b = new BigDecimal(total);
		e = new BigDecimal(1);
		h = new BigDecimal(100);
		BigDecimal c = b.divide(a, 2, RoundingMode.HALF_UP);
		int f = c.compareTo(e);
		if(f>0){
			this.percentage = "100";
		}else{
			this.percentage = c.multiply(h).toString();
		}
	}

	public String getTotalKm() {
		return totalKm;
	}

	public void setTotalKm(Integer totalStep) {
		BigDecimal b1 = new BigDecimal("0.4877");
		BigDecimal b2 = new BigDecimal(totalStep);
		BigDecimal b5 = b1.multiply(b2);
		DecimalFormat df1 = new DecimalFormat("0.00");
        String str = df1.format(b5);
		this.totalKm = str;
	}

	public String getTotalKa() {
		return totalKa;
	}

	public void setTotalKa(String totalKa) {
		this.totalKa = totalKa;
	}
	
	public void setTotalKa(Integer weight,Integer step) {
		BigDecimal b1 = new BigDecimal("1.036");
		BigDecimal b2 = new BigDecimal(weight);
		BigDecimal b3 = new BigDecimal(step);
		BigDecimal b5 = b1.multiply(b2).multiply(b3);
		this.totalKa = b5.toString();
	}

	public List<StepListResponseVo> getList() {
		return list;
	}

	public void setList(List<StepListResponseVo> list) {
		this.list = list;
	}
	
}
